package com.colin.util.design.chain.impl;

import com.colin.util.design.chain.ChainContext;
import com.colin.util.design.chain.PlatWithdrawDeal;
import com.colin.util.design.chain.base.ChainDto;
import com.colin.util.design.chain.base.ChainTemplate;
import com.colin.util.design.chain.request.PlatWithdrawDealRequest;
import com.colin.util.exception.BusiException;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class PlatWithdrawDrawingDeal extends ChainTemplate implements PlatWithdrawDeal {
    
    @Resource
    private ChainContext chainContext;
    
    @Override
    public void deal(ChainDto chainDto) throws BusiException {
        handle(chainDto);
    }

    @Override
    protected void dealChain(ChainDto chainDto) throws BusiException {
        System.out.println("PlatWithdrawDrawingDeal_come");
        PlatWithdrawDealRequest request = (PlatWithdrawDealRequest)chainDto.getRequest();
        if(request.getStatus() == 2){
            System.out.println("PlatWithdrawDrawingDeal_deal");
            chainDto.getResponse().setMessage("PlatWithdrawDrawingDeal_deal_success");
        }
    }

    @Override
    protected void nextChain(ChainDto chainDto) throws BusiException {
        chainContext.nextPlatWithdrawDeal(chainDto);
    }
}
